import React, {Component} from 'react';
import {base, high} from 'nc-lightapp-front';
import getComponent from "../../functions/getComponent";

class BatchEditComp extends Component {
    constructor(props) {
        super(props);
    }

    getInfo() {
        let info = {};
        this.config.forEach(item => {
            if (this.state[item.key + '_flag']) {
                if (item.type === 'refer') {
                    if (this.state[item.key]) {
                        info[item.key] = this.state[item.key].refpk
                    }
                } else {
                    const value = this.state[item.key];
                    info[item.key] = value === undefined ?
                        (item.type === 'switch' || item.type === 'checkbox') ? false : '' : value
                }
            }
        });
        return info;
    }

    render() {
        return (
            <div>
                {getComponent.call(this)}
            </div>
        );
    }
}

export default BatchEditComp;
